package cn.edu.cuit.elena.web.tool;

public class CommonHelper
{

    public static final String ORACLE_DRIVER = "oracle.jdbc.driver.OracleDriver";
    public static final String MYSQL_DRIVER = "com.mysql.jdbc.Driver";
    public static final String SQLSERVER_DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
    public static final String DB2_DRIVER = "com.ibm.db2.jcc.DB2Driver";
    public static final String SY_DRIVER = "com.sybase.jdbc3.jdbc.SybDriver";

    public static String matchVender( String dbCode )
    {
        if( "1".equals( dbCode ) )
        {
            return "Oracle  ORACLE DATABASE 11g";
        }
        else if( "2".equals( dbCode ) )
        {
            return "Oracle  ORACLE DATABASE 10g";
        }
        else if( "3".equals( dbCode ) )
        {
            return "Oracle  ORACLE DATABASE 9i";
        }
        else if( "4".equals( dbCode ) )
        {
            return "Oracle  MySql 5.0.22";
        }
        else if( "5".equals( dbCode ) )
        {
            return "Oracle  MySql 5.2.20a";
        }
        else if( "6".equals( dbCode ) )
        {
            return "Oracle  MySql 4.*";
        }
        else if( "7".equals( dbCode ) )
        {
            return "Mircrosoft  Sql Server 2008";
        }
        else if( "8".equals( dbCode ) )
        {
            return "Mircrosoft  Sql Server 2005";
        }
        else if( "9".equals( dbCode ) )
        {
            return "Mircrosoft  Sql Server 2000";
        }
        else if( "10".equals( dbCode ) )
        {
            return "IBM  DB2 9.*";
        }
        else if( "11".equals( dbCode ) )
        {
            return "IBM  DB2 8.*";
        }
        else if( "12".equals( dbCode ) )
        {
            return "IBM  DB2 7.*";
        }
        else if( "13".equals( dbCode ) )
        {
            return "Sy  Base  *";
        }
        else
        {
            return "";
        }
    }

    public static String matchDriver( String dbCode )
    {
        if( "1".equals( dbCode ) )
        {
            return ORACLE_DRIVER;
        }
        else if( "2".equals( dbCode ) )
        {
            return ORACLE_DRIVER;
        }
        else if( "3".equals( dbCode ) )
        {
            return ORACLE_DRIVER;
        }
        else if( "4".equals( dbCode ) )
        {
            return MYSQL_DRIVER;
        }
        else if( "5".equals( dbCode ) )
        {
            return MYSQL_DRIVER;
        }
        else if( "6".equals( dbCode ) )
        {
            return MYSQL_DRIVER;
        }
        else if( "7".equals( dbCode ) )
        {
            return SQLSERVER_DRIVER;
        }
        else if( "8".equals( dbCode ) )
        {
            return SQLSERVER_DRIVER;
        }
        else if( "9".equals( dbCode ) )
        {
            return SQLSERVER_DRIVER;
        }
        else if( "10".equals( dbCode ) )
        {
            return DB2_DRIVER;
        }
        else if( "11".equals( dbCode ) )
        {
            return DB2_DRIVER;
        }
        else if( "12".equals( dbCode ) )
        {
            return DB2_DRIVER;
        }
        else if( "13".equals( dbCode ) )
        {
            return SY_DRIVER;
        }
        else
        {
            return "";
        }
    }
}
